package com.akl.ssmspringboot.controller;

import com.akl.ssmspringboot.entity.LoginLog;
import com.akl.ssmspringboot.service.LoginLogService;
import com.baomidou.mybatisplus.plugins.Page;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Date;
import java.util.List;

/**
 * @author guoxy
 * @date 2018/12/12 13:35
 * @description
 */
@Controller
@RequestMapping("/loginLog")
public class LoginLogController {

    @Autowired
    private LoginLogService loginLogService;

    @RequestMapping("/list")
    public String table() {
        return "./loginLog/list";
    }

    @RequestMapping("/ajax/list.json")
    @ResponseBody
    public JSONObject arrays(Page<LoginLog> page) {
        Page<LoginLog> list = loginLogService.selectPage(page);
        List<LoginLog> result = list.getRecords();
        JSONObject obj = new JSONObject();
        obj.put("data",result);
        return obj;
    }
}
